<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
<div id="app">
	<login :parentmsg="msg" @func="show"></login>
</div>
<template id="tmpl">
	<div>
		<h1>登陆组件------{{ parentmsg }}</h1>
		<input type="text" v-model="sonmsg">
		<input type="button" value="调用父组件的方法" @click="sonshow">
	</div>
</template>
<script src="node_modules/vue/dist/vue.js"></script>
<script>
var login = {
	template : '#tmpl',
	data(){
		return {sonmsg:'这个是子组件上的属性'}
	},
	methods:{
		sonshow(){
			this.$emit('func', this.sonmsg)
		}
	},
	props : ['parentmsg']
}
var vm = new Vue({
	el : '#app',
	data : {
		msg : '这个是父组件上的msg'
	},
	methods : {
		show(sondata){
			alert('这个是父组件的alert' + sondata)
		}
	},
	components : {
		login
	}
})
</script>
</body>
</html>